#include<bits/stdc++.h>
using namespace std;
struct data
{
	int p,w;
}a[200005],b[200005];
int n,tot,t;
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	a[0].p=-1;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i].p );
		a[i].w=i;
	}tot=n;
	t=n;
	while(t!=0){
		tot=0;
		for(int i=1;i<=t;i++)
			if(a[i].p!=a[i-1].p)printf("%d ",a[i].w );
			else {
				tot++;
				b[tot]=a[i];
			}
		for(int i=1;i<=tot;i++)
			a[i]=b[i];
		printf("\n");
		t=tot;
	}
	return 0;
}
